<template>
  <div id="goodsList">
    <div class="rightBox">
      <div class="btn_group">
        <button
          :class="{ active: input_btn == '销量榜' }"
          @click="input_btn = '销量榜'"
        >
          销量榜
        </button>
        <button
          :class="{ active: input_btn == '抖in爆款榜' }"
          @click="input_btn = '抖in爆款榜'"
        >
          抖in爆款榜
        </button>
      </div>
      <div class="rightBox-content">
        <SaleList v-if="input_btn == '销量榜'" />
        <Inpopular v-if="input_btn == '抖in爆款榜'" />
      </div>
    </div>
  </div>
</template>

<script>
import SaleList from "./SaleList";
import Inpopular from "./Inpopular";
export default {
  name: "goodsList",
  components: {
    SaleList,
    Inpopular,
  },
  data() {
    return {
      input_btn: "销量榜",
    };
  },
  computed: {},
  watch: {
    // input_btn: function (newVal, oldVal) {
    //   if (newVal == "销量榜") {
    //     this.input_btn = "销量榜";
    //   }
    // },
  },
  created() {
    let tabName = this.$route.query.tabName;
    if(tabName){
      this.input_btn = tabName;
    }
  },
  mounted() {},
  methods: {},
};
</script>
<style lang='less' scoped>
#goodsList {
  margin-top: @margin-num;
  margin-left: @margin-num;
  margin-right: @margin-num;
  height: fit-content;
  border-radius: 4px;
  min-height: 100vh;
  position: relative;
  .rightBox {
    -webkit-box-sizing: border-box;
    box-sizing: border-box;

    height: 100%;
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    border-radius: 6px;
    .btn_group {
      .active {
        background-color: #fd7f2c;
        color: #ffffff !important;
      }
      button {
        font-size: 14px;
        color: #555;
        padding-left: 23px;
        padding-right: 23px;
        height: 40px;
        background-color: #fff;
        border-radius: 4px;
        margin-right: 7px;
        font-weight: 600;
      }
    }
  }
  .rightBox-content {
    background-color: #ffffff;
    border-radius: 6px;
    margin-top: -20px;
  }
}
</style>